﻿//self jq
$(function () {
    var clicknumber_store = 0;
    //menu downtoggle 4.0
    $("#disstroe").click(
	function () {
	    $("#disstroe-sub").slideToggle("fast");
	    if (clicknumber_store == 1) {
	        $("#disstroe .arrow").removeClass("arrow-rotate");
	        clicknumber_store = 0;
	    }
	    else {
	        $("#disstroe .arrow").addClass("arrow-rotate");
	        clicknumber_store = 1;
	    }
	}
	)
    //menu accordian
    $("#menu-accordian01,#menu-accordian02").click(function () {
        $(this).parents(".member-nav").siblings(".member-nav").find("a").siblings("div").slideUp();
        $(this).parents(".member-nav").siblings(".member-nav").find("a").children(".arrow").removeClass("arrow-rotate");
        if ($(this).siblings("div").css('display') == 'block') {
            $(this).siblings("div").slideUp();
            $(this).children(".arrow").removeClass("arrow-rotate");
        }
        else {
            $(this).siblings("div").slideDown();
            $(this).children(".arrow").addClass("arrow-rotate");
        }
    })
    $(".mask").click(function () { footHide(); })
    //alert frame
    function box_frame(txt) {
        $('body').prepend("<div class='alert-box-2btn' id='alert-box-2btn'><div class='content-box'><p>" + txt + "</p><div class='btn-div clear'><a class='btn-verify' href=''>确定</a><a class='btn-cancle' id='alert-2btm-close' href=''>取消</a></div></div></div>")
    };

    //alert content text 
    $("#order-receive , [data-id='order-receive']").on("click", function (event) {
        event.preventDefault();
        box_frame('亲，点击确认收货后不可再退货！如果您需要申请退款，切勿点击“确认收货”');
        $(".btn-div").delegate("#alert-2btm-close", "click", function (event) {
            event.preventDefault();
            $("#alert-box-2btn").detach();
        })
    });
    //alert prolong receive
    $("[data-id='prolongreceive']").on("click", function (event) {
        event.preventDefault();
        box_frame('确认延长收货时间？每笔订单只能延长一次（3天）哦！')
        $(".btn-div").delegate("#alert-2btm-close", "click", function (event) {
            event.preventDefault();
            $("#alert-box-2btn").detach();
        })
    })
    //alert prolong check
    $("[data-id='prolongcheck']").on("click", function (event) {
        event.preventDefault();
        box_frame('确认延迟提货时间？每笔订单只能延长一次哦！')
        $(".btn-div").delegate("#alert-2btm-close", "click", function (event) {
            event.preventDefault();
            $("#alert-box-2btn").detach();
        })
    });
    //alert wechat address verify
    $("#wechataddress-verify").on("click", function (event) {
        event.preventDefault();
        box_frame("v5shop.com.cn要更您的收货地址，是否允许？");
        $(".btn-div").delegate("#alert-2btm-close", "click", function (event) {
            event.preventDefault();
            $("#alert-box-2btn").detach();
        })
    });
    $("#address-list li").on("click", function () {
        $(this).parent().find(".icon-success").hide();
        $(this).find(".icon-success").show();
    })
    $("#address-list li .div-simply").on("taphold", function (event) {
        event.preventDefault();
        $(".alert-addressoperate-mask").show();
        $(".alert-addressoperate-c").show();
    })
    $(".alert-addressoperate-mask").on("tap", function () {
        $(".alert-addressoperate-mask").hide();
        $(".alert-addressoperate-c").hide();
    });
    //add account
    $("#acount-select").children("div").on("click", function () {
        if (($(this).children("input").prop("checked") == true) && ($(this).children("input").val() == "alipay")) {
            $("#blank-div").hide();
            $("#acount-content").find("input[name='name']").attr("placeholder", "真实姓名");
            $("#acount-content").find("input[name='account']").attr("placeholder", "账号");

        }
        if (($(this).children("input").prop("checked") == true) && ($(this).children("input").val() == "blank")) {
            $("#blank-div").show();
            $("#acount-content").find("input[name='name']").attr("placeholder", "持卡人");
            $("#acount-content").find("input[name='account']").attr("placeholder", "卡号");
        }
    });
    //ios4 fixed
    var isIOS = (/iphone|ipad/gi).test(navigator.appVersion);
    if (isIOS) {
        $('form').on('focus', 'input , textarea ,select', function () {
            $('.tab-bar').addClass('relative');
            $('form').removeClass('mt-55')
            $('form').addClass('mt-15')
        }).on('focusout', 'input , textarea ,select', function () {
            $('.tab-bar').removeClass('relative');
            $('form').addClass('mt-55');
        });

        //distalk-msg
        $("[data-toggle=input-msg]").on('focus', function () {
            $('.bottom.bottom-input').removeClass("emotions-focus");
            $('.talk-detail').css('margin-bottom', '0');

            $('.tab-bar').addClass('relative');
            $('.talk-detail').removeClass('mt-55');
            $('.talk-detail').addClass('mt-15');
        }).on('focusout', function () {
            $('.tab-bar').removeClass('relative');
            $('.talk-detail').addClass('mt-55');
        });

        //disstore1   my-members-notrade
        $("[data-toggle=seach-name] .search-input").on('focus', function () {
            $('.tab-bar').addClass('relative');
            $('.memberhead').css('margin-top', '0');
        }).on('focusout', function () {
            $('.tab-bar').removeClass('relative');
            $('.memberhead').css('margin-top', '45px');
        });
    };
    //pact alert
    $("#pact-a").on("click", function (event) {
        event.preventDefault();
        $("#alert-box-pact").fadeIn();
    });
    $("#pact-close,#btn-agree").on("click", function (event) {
        event.preventDefault();
        $("#alert-box-pact").fadeOut();
    });
    //deposit money	select
    $("[data-deposit='deposit_money'] .columns").on("click", function () {
        $("[data-deposit='deposit_money'] .columns").removeClass("current");
        $(this).addClass("current");
    });
    //share
    $("#share").on("click", function (event) {
        event.preventDefault();
        $("#share-tip").fadeIn();
    });
    $("#a-know").on("click", function () {
        $("#share-tip").fadeOut();
    });
    //personer info
    $("[data-person='person_info_other_title']").on("click", function () {
        $("[data-person='person_info_other_title']").children(".arrow").toggleClass("arrow-rotate")
        $("[data-person='person_info_other_c']").slideToggle();
    });

    //extract
    $("[data-toggle=extract-style]").on("click", function () {
        $("[data-toggle=extract-style] .icon-radius").removeClass('checked');
        $(this).children("a").children(".icon-radius").addClass("checked")
    });

    //sign
    $("[data-toggle=show-sign]").on("click", function () {
        $(".mask-sign").show();
        $("#sign-modal").show();
    });
    $("[data-toggle=close-sign]").on("click", function () {
        $("#sign-modal").hide();
        $(".mask-sign").hide();
    });

    //mytreasure
    $("[data-toggle='show-more']").on("click", function () {
        $(".alert-treasure-num").show();
        $("#alert-mask").show();
    });
    $("[data-toggle='close-more'],#alert-mask").on("click", function () {
        $(".alert-treasure-num").hide();
        $("#alert-mask").hide();
    });

    //my-members-notrade
    $("[data-toggle=seach-name] .type-box").on('click', function () {
        $('.search-member').toggleClass('active');
    });
    $("[data-toggle=seach-name] .type-option a").on('click', function () {
        $(".type-name").html($(this).text());
    });

    //distalk-msg
    $("[data-toggle=input-msg]").on('focus', function () {
        $('.bottom.bottom-input').removeClass("emotions-focus");
        $('.talk-detail').css('margin-bottom', '0');
    });

    $("[data-toggle=close-input]").on('click', function () {
        $('.bottom.bottom-input').removeClass("emotions-focus");
        $('.talk-detail').css('margin-bottom', '0');
    });

    //dl.sub-nav.nav-b5 dd
    var leg = $("dl.sub-nav.nav-b5 dd").length;
    var wid = "100" / leg;
    $("dl.sub-nav.nav-b5 dd").css("width", wid + "%");
});
//share toggle
function share_foot() {
    $(".mask").fadeToggle();
    $(".shareList").fadeToggle();
}
function footHide() {
    $(".mask").fadeOut();
    $(".shareList").fadeOut();
}

//distribute store list
function disstore_show_hide(obj) {
    if ($(obj).next('.disstore-count').css('display') == 'block') {
        $(".disstore-count").slideUp();
        $(obj).find(".arrow").css({
            "-webkit-transform": "rotate(0deg)",
            "-moz-transform": "rotate(0deg)",
            "-o-transform": "rotate(0deg)",
            "transform": "rotate(0deg)",
            "-webkit-transition": "all .3s",
            "-moz-transition": "all .3s",
            "-o-transition": "all .3s",
            "transition": "all .3s"
        });
    }
    else {
        $(".disstore-count").slideUp();
        $(".a-personal").find(".arrow").css({
            "-webkit-transform": "rotate(0deg)",
            "-moz-transform": "rotate(0deg)",
            "-o-transform": "rotate(0deg)",
            "transform": "rotate(0deg)",
            "-webkit-transition": "all .3s",
            "-moz-transition": "all .3s",
            "-o-transition": "all .3s",
            "transition": "all .3s"
        });
        $(obj).find(".arrow").removeClass("arrow-rotate");
        $(obj).next(".disstore-count").slideDown("fast");
        $(obj).find(".arrow").addClass("arrow-rotate");
        $(obj).find(".arrow").css({
            "-webkit-transform": "rotate(90deg)",
            "-moz-transform": "rotate(90deg)",
            "-o-transform": "rotate(90deg)",
            "transform": "rotate(90deg)",
            "-webkit-transition": "all .3s",
            "-moz-transition": "all .3s",
            "-o-transition": "all .3s",
            "transition": "all .3s"
        });
    }
}
(function () {
    //member count
    function member_infor(obj) {
        $(".member-browse-detail").slideUp();
        if ($(obj).parents().next(".member-browse-detail").css("display") == "block") {
            $($(obj).parents().next(".member-browse-detail")).slideUp();
        }
        else {
            $($(obj).parents().next(".member-browse-detail")).slideDown();
        }
    }
    window.member_infor = member_infor;

    //member no trade	
    function member_notrade(obj) {
        $(".member-notrade-detail").slideUp();
        if ($(obj).parents().next(".member-notrade-detail").css("display") == "block") {
            $($(obj).parents().next(".member-notrade-detail")).slideUp();
        }
        else {
            $($(obj).parents().next(".member-notrade-detail")).slideDown();
        }
    }
    window.member_notrade = member_notrade;


    function member_pro(obj) {
        $(".member-browser-pro-list").slideUp();
        if ($(obj).next(".member-browser-pro-list").css("display") == "block") {
            $($(obj).next(".member-browser-pro-list")).slideUp();
            $(obj).find(".arrow").css({
                "-webkit-transform": "rotate(0deg)",
                "-moz-transform": "rotate(0deg)",
                "-o-transform": "rotate(0deg)",
                "transform": "rotate(0deg)",
                "-webkit-transition": "all .3s",
                "-moz-transition": "all .3s",
                "-o-transition": "all .3s",
                "transition": "all .3s"
            });
        }
        else {
            $($(obj).next(".member-browser-pro-list")).slideDown();
            $(obj).find(".arrow").css({
                "-webkit-transform": "rotate(90deg)",
                "-moz-transform": "rotate(90deg)",
                "-o-transform": "rotate(90deg)",
                "transform": "rotate(90deg)",
                "-webkit-transition": "all .3s",
                "-moz-transition": "all .3s",
                "-o-transition": "all .3s",
                "transition": "all .3s"
            });
        }
    }
    window.member_pro = member_pro;
    //member list
    function member_info(obj) {
        if ($(obj).next('.member-list-count').css('display') == 'block') {
            $(".member-list-count").slideUp();
            $(obj).find(".arrow").css({
                "-webkit-transform": "rotate(0deg)",
                "-moz-transform": "rotate(0deg)",
                "-o-transform": "rotate(0deg)",
                "transform": "rotate(0deg)",
                "-webkit-transition": "all .3s",
                "-moz-transition": "all .3s",
                "-o-transition": "all .3s",
                "transition": "all .3s"
            });
        }
        else {
            $(".member-list-count").slideUp();
            $(".a-personal").find(".arrow").css({
                "-webkit-transform": "rotate(0deg)",
                "-moz-transform": "rotate(0deg)",
                "-o-transform": "rotate(0deg)",
                "transform": "rotate(0deg)",
                "-webkit-transition": "all .3s",
                "-moz-transition": "all .3s",
                "-o-transition": "all .3s",
                "transition": "all .3s"
            });
            $(obj).find(".arrow").removeClass("arrow-rotate");
            $(obj).next(".member-list-count").slideDown("fast");
            $(obj).find(".arrow").addClass("arrow-rotate");
            $(obj).find(".arrow").css({
                "-webkit-transform": "rotate(90deg)",
                "-moz-transform": "rotate(90deg)",
                "-o-transform": "rotate(90deg)",
                "transform": "rotate(90deg)",
                "-webkit-transition": "all .3s",
                "-moz-transition": "all .3s",
                "-o-transition": "all .3s",
                "transition": "all .3s"
            });
        }
    }
    window.member_info = member_info;
    //tip means close
    function tip_means_close(obj) {
        $(obj).parents(".tip-means").slideUp();
    }
    window.tip_means_close = tip_means_close;
})();

//brokerage list 
function brokerage_show_hide(obj) {
    if ($(obj).next('.money-source').css('display') == 'block') {
        $(".money-source").slideUp();
        $(obj).find(".arrow").css({
            "-webkit-transform": "rotate(0deg)",
            "-moz-transform": "rotate(0deg)",
            "-o-transform": "rotate(0deg)",
            "transform": "rotate(0deg)",
            "-webkit-transition": "all .3s",
            "-moz-transition": "all .3s",
            "-o-transition": "all .3s",
            "transition": "all .3s"
        });
    }
    else {
        $(".money-source").slideUp();
        $(".a-personal").find(".arrow").css({
            "-webkit-transform": "rotate(0deg)",
            "-moz-transform": "rotate(0deg)",
            "-o-transform": "rotate(0deg)",
            "transform": "rotate(0deg)",
            "-webkit-transition": "all .3s",
            "-moz-transition": "all .3s",
            "-o-transition": "all .3s",
            "transition": "all .3s"
        });
        $(obj).find(".arrow").removeClass("arrow-rotate");
        $(obj).next(".money-source").slideDown("fast");
        $(obj).find(".arrow").addClass("arrow-rotate");
        $(obj).find(".arrow").css({
            "-webkit-transform": "rotate(90deg)",
            "-moz-transform": "rotate(90deg)",
            "-o-transform": "rotate(90deg)",
            "transform": "rotate(90deg)",
            "-webkit-transition": "all .3s",
            "-moz-transition": "all .3s",
            "-o-transition": "all .3s",
            "transition": "all .3s"
        });
    }
}

//disstore2 list 
function disstore2_show_hide(obj) {
    if ($(obj).next('.amount').css('display') == 'block') {
        $(".amount").slideUp();
        $(obj).find(".arrow").css({
            "-webkit-transform": "rotate(0deg)",
            "-moz-transform": "rotate(0deg)",
            "-o-transform": "rotate(0deg)",
            "transform": "rotate(0deg)",
            "-webkit-transition": "all .3s",
            "-moz-transition": "all .3s",
            "-o-transition": "all .3s",
            "transition": "all .3s"
        });
    }
    else {
        $(".amount").slideUp();
        $(".a-personal").find(".arrow").css({
            "-webkit-transform": "rotate(0deg)",
            "-moz-transform": "rotate(0deg)",
            "-o-transform": "rotate(0deg)",
            "transform": "rotate(0deg)",
            "-webkit-transition": "all .3s",
            "-moz-transition": "all .3s",
            "-o-transition": "all .3s",
            "transition": "all .3s"
        });
        $(obj).find(".arrow").removeClass("arrow-rotate");
        $(obj).next(".amount").slideDown("fast");
        $(obj).find(".arrow").addClass("arrow-rotate");
        $(obj).find(".arrow").css({
            "-webkit-transform": "rotate(90deg)",
            "-moz-transform": "rotate(90deg)",
            "-o-transform": "rotate(90deg)",
            "transform": "rotate(90deg)",
            "-webkit-transition": "all .3s",
            "-moz-transition": "all .3s",
            "-o-transition": "all .3s",
            "transition": "all .3s"
        });
    };
};